#!/bin/bash
root_dir=/usr/local/edata
echo "$(date +"%Y-%m-%d %H:%M:%S") INFO uninstall is running..."
echo "$(date +"%Y-%m-%d %H:%M:%S") INFO checking spark mode..."
running_mode=$(cat mode)
echo "$(date +"%Y-%m-%d %H:%M:%S") INFO current mode of spark is $running_mode"

echo "$(date +"%Y-%m-%d %H:%M:%S") INFO remove $root_dir/spark"
rm mode
rm master
rm -rf $root_dir/spark
if [[ $? -eq 0 ]];then
  echo "$(date +"%Y-%m-%d %H:%M:%S") INFO spark uninstall success"
else
  echo "$(date +"%Y-%m-%d %H:%M:%S") ERROR spark uninstall error"
fi